| API Documentation |  |

- MAIN PAGE
- NAMESPACES
- CLASSES

Classes | Public Member Functions | Static Public Member Functions | List of all members
nkWinUi::TabWindow Class Referenceabstract

A graphical tab window. More...

Inheritance diagram for nkWinUi::TabWindow:

## Classes
class | Tab
| Holds information about a tab in the window. More...

## Public Member Functions
| TabWindow (System *system) noexcept
virtual | ~TabWindow ()
virtual Tab * | addTab (nkMemory::StringView label)
Tab * | getTabByLabel (nkMemory::StringView label) const
Tab * | getTabById (int id) const
Tab * | getTabByIndex (unsigned int index) const
virtual Tab * | getTabByMouseRel (nkMaths::Point mouseRel) const =0
int | getTabIndex (Tab *tab) const
unsigned int | getTabCount () const
virtual void | reorderTab (Tab *tab, unsigned int newIndex)
virtual void | eraseTab (Tab *tab)
virtual Layout * | setLayout (LAYOUT_TYPE layoutType) override
virtual void | setActiveTab (Tab *toActivate)
Tab * | getActiveTab () const
virtual void | adaptToDisplayArea (Window *toAdapt) const =0
void | setTabSwitchCallback (std::function< bool(TabWindow *, TabWindow::Tab *, bool)> value)
const std::function< bool(TabWindow *, TabWindow::Tab *, bool)> & | getTabSwitchCallback () const
virtual void | exportIntrospection (nkExport::Node *rootNode) override
virtual void | importClassFromTree (nkExport::Node *rootNode) override
Public Member Functions inherited from nkWinUi::Component
| Component (System *system) noexcept
virtual | ~Component ()
Layout * | getLayout () const
Theme * | getTheme () const
Font * | getFont () const
nkMaths::Point | getPositionInParent () const
nkMaths::Point | getPositionInScreen () const
float | getWidth () const
float | getHeight () const
nkMaths::Rectangle | getAreaInParent () const
nkMaths::Rectangle | getAreaInScreen () const
virtual nkMaths::Point | getBorderExtents () const
virtual float | getBorderExtent (BORDER_KIND border) const
virtual float | getLayoutAllowedWidth () const
virtual float | getLayoutAllowedHeight () const
virtual float | getLayoutAllowedOffsetX () const
virtual float | getLayoutAllowedOffsetY () const
bool | isInitialized () const
System * | getSystem () const
Component * | getParentComponent () const
COMPONENT_TYPE | getComponentType () const
nkMemory::StringView | getComponentName () const
bool | getVisibility () const
virtual nkMemory::StringView | getLabel () const
void * | getData () const
bool | isEnabled () const
bool | isForegroundWindow () const
virtual unsigned int | getZDepth () const
bool | getVisibleOnLoad () const
std::function< bool(Component *)> | getCloseCallback () const
std::function< void(Component *, bool)> | getVisibilityCallback () const
std::function< void(Component *, const ClickEventData &)> | getClickCallback () const
std::function< void(Component *, const WheelEventData &)> | getWheelCallback () const
std::function< void(Component *, const KeyEventData &)> | getKeyCallback () const
virtual void | setTheme (Theme *theme)
virtual void | setFont (Font *font)
virtual void | setPositionInParent (nkMaths::Point position)
virtual void | setPositionInScreen (nkMaths::Point position)
virtual void | setSize (float width, float height)
virtual void | setWidth (float width)
virtual void | setHeight (float height)
void | setMinSize (float width, float height)
void | setMaxSize (float width, float height)
void | setRatio (float widthOverHeight)
virtual void | setAreaInParent (const nkMaths::Rectangle &area)
virtual void | setAreaInScreen (const nkMaths::Rectangle &area)
virtual void | setParentComponent (Component *parent, bool makeItVisible=true)
virtual void | setLabel (nkMemory::StringView label)
void | setComponentName (nkMemory::StringView name)
virtual void | setVisibility (bool value)
void | setData (void *data)
void | setEnabled (bool value)
void | setVisibleOnLoad (bool value)
void | setCloseCallback (std::function< bool(Component *caller)> callback)
void | setVisibilityCallback (std::function< void(Component *caller, bool visibility)> callback)
void | setClickCallback (std::function< void(Component *caller, const ClickEventData &eventData)> callback)
void | setWheelCallback (std::function< void(Component *caller, const WheelEventData &eventData)> callback)
void | setKeyCallback (std::function< void(Component *caller, const KeyEventData &eventData)> callback)
void | addChild (Component *child, bool makeItVisible=true)
void | removeChild (Component *child)
void | removeChild (unsigned int index)
Component * | getChild (unsigned int index)
unsigned int | getChildIndex (Component *child)
void | unloadWithChildren ()
void | loadWithChildren ()
void | updateZDepth ()
void | bringToForeground ()
void | focusWindow ()
nkMaths::Point | getCoordRelativeFromAbsolute (nkMaths::Point absCoords)
nkMaths::Point | getCoordAbsoluteFromRelative (nkMaths::Point relCoords)
virtual void | load ()=0
virtual void | unload ()=0
void | reload ()
virtual void | updateWindow ()
nkImages::Image | paintToImage (bool withFrame=false)
void | simulateEvent (const InputDescriptor &inputDescription)
virtual void | onSized ()
virtual void | exportClassToTree (nkExport::Node *rootNode) override
Public Member Functions inherited from nkExport::Exportable
| Exportable () noexcept
virtual | ~Exportable ()

## Static Public Member Functions
static nkMemory::UniquePtr< TabWindow > | create (System *system=nullptr)

## Detailed Description

A graphical tab window.

## Constructor & Destructor Documentation

## ◆ TabWindow()

nkWinUi::TabWindow::TabWindow | ( | System * | system | ) |
| noexcept

Constructor.

Parameters

  system | The parent system in which the component will live.

Remarks
  See ComponentManager::createOrRetrieve().

## ◆ ~TabWindow()

virtual nkWinUi::TabWindow::~TabWindow | ( |  | ) |
| virtual

Destructor.

## Member Function Documentation

## ◆ addTab()

virtual Tab* nkWinUi::TabWindow::addTab | ( | nkMemory::StringView | label | ) |
| virtual

Adds a tab to the window.

Parameters

  label | The tab label to insert.

Returns
  The newly created tab.

Remarks
  The TabWindow owns the Tab memory.

## ◆ getTabByLabel()

Tab* nkWinUi::TabWindow::getTabByLabel | ( | nkMemory::StringView | label | ) | const

Parameters

  label | The label of the tab to retrieve.

Returns
  The tab attached to given labl if available, nullptr else.

## ◆ getTabById()

Tab* nkWinUi::TabWindow::getTabById | ( | int | id | ) | const

Parameters

  id | The id of the tab to retrieve.

Returns
  The tab attached to given id if available, nullptr else.

## ◆ getTabByIndex()

Tab* nkWinUi::TabWindow::getTabByIndex | ( | unsigned int | index | ) | const

Parameters

  index | The index of the tab to retrieve, corresponding to its index in the displaying order, from left to right.

Returns
  The tab at given index if available, nullptr else.

## ◆ getTabByMouseRel()

virtual Tab* nkWinUi::TabWindow::getTabByMouseRel | ( | nkMaths::Point | mouseRel | ) | const
| pure virtual

Parameters

  mouseRel | The cursor position, in pixels relative to the window, to pick for a tab.

Returns
  The tab head touched by the mouse position if available, nullptr else.

## ◆ getTabIndex()

int nkWinUi::TabWindow::getTabIndex | ( | Tab * | tab | ) | const

Parameters

  tab | The tab from which the index is wanted.

Returns
  The index requested if available, -1 else.

Remarks
  An index can change in the lifetime of a tab through reordering or erasing. As such, the index returned by this method should not be stored, unless you know tab memory won't change.

## ◆ getTabCount()

unsigned int nkWinUi::TabWindow::getTabCount | ( |  | ) | const

Returns
  The number of tabs within the window.

## ◆ reorderTab()

virtual void nkWinUi::TabWindow::reorderTab | ( | Tab * | tab,
|  | unsigned int | newIndex
| ) |  |
| virtual

Updates a given tab's index, reinserting it in the tab set at given index. This will change a given tab's position in the window.

Parameters

  tab | The tab to move around.
  newIndex | The new index to move it to.

Remarks
  This will move around the tab, possibly pushing other tabs to make a spot.

## ◆ eraseTab()

virtual void nkWinUi::TabWindow::eraseTab | ( | Tab * | tab | ) |
| virtual

Erases a tab and free its memory.

Parameters

  tab | The tab to erase.

## ◆ setLayout()

virtual Layout* nkWinUi::TabWindow::setLayout | ( | LAYOUT_TYPE | layoutType | ) |
| override virtual

Sets the layout to use in the currently active window, associated to the active tab. See Component::setLayout() for details.

Reimplemented from nkWinUi::Component.

## ◆ setActiveTab()

virtual void nkWinUi::TabWindow::setActiveTab | ( | Tab * | toActivate | ) |
| virtual

Sets the tab currently active and displayed.

Parameters

  toActivate | The tab to active.

## ◆ getActiveTab()

Tab* nkWinUi::TabWindow::getActiveTab | ( |  | ) | const

Returns
  The active tab.

## ◆ adaptToDisplayArea()

virtual void nkWinUi::TabWindow::adaptToDisplayArea | ( | Window * | toAdapt | ) | const
| pure virtual

Adapts a window to fit within the tab window displaying area.

Parameters

  toAdapt | The window which size should be adapted.

## ◆ setTabSwitchCallback()

void nkWinUi::TabWindow::setTabSwitchCallback | ( | std::function< bool(TabWindow *, TabWindow::Tab *, bool)> | value | ) |

Sets the tab switch callback.

Parameters

  value | The callback to use. It will receive the calling component, the selected tab and whether the tab is changing and not yet fully selected. The callback should return a boolean stating whether the tab can be switched to while it changing (true) or if the change should not occur (false). When a switch occur, this callback is called twice : once with the changing flag on, and a second time with it off if true has been returned during the first call.

## ◆ getTabSwitchCallback()

const std::function<bool (TabWindow*, TabWindow::Tab*, bool)>& nkWinUi::TabWindow::getTabSwitchCallback | ( |  | ) | const

Returns
  Currently set tab switch callback.

## ◆ exportIntrospection()

virtual void nkWinUi::TabWindow::exportIntrospection | ( | nkExport::Node * | rootNode | ) |
| override virtual

A basic exporting capability, for components inheriting. Components inheriting this class should rather reimplement this function to export their internal data.

Parameters

  rootNode | The root of the tree to export into.

Reimplemented from nkWinUi::Component.

## ◆ importClassFromTree()

virtual void nkWinUi::TabWindow::importClassFromTree | ( | nkExport::Node * | rootNode | ) |
| override virtual

A basic importing capability.

Parameters

  rootNode | The root of the tree to import from.

Reimplemented from nkWinUi::Component.

## ◆ create()

static nkMemory::UniquePtr<TabWindow> nkWinUi::TabWindow::create | ( | System * | system = `nullptr` | ) |
| static

Creates a standalone component, linking it to a system, but no manager. This method can be used to allocate a component and manually manage its lifetime.

Parameters

  system | The system to create the component into. If left to nullptr, then the Singleton instance will be used.

Returns
  The created component instance.

The documentation for this class was generated from the following file:

- Documentation/Headers/NilkinsWinUi/Components/TabWindow.h